<?php 
include_once($_SERVER['DOCUMENT_ROOT'].'/home/public/header.php');
$search=isset($_GET['search'])?$_GET['search']:'';
$sum=3;
$p=isset($_GET['p'])&&!empty($_GET['p'])?$_GET['p']:1;
// var_dump($p);die;
$off=($p-1)*3; 
if (empty($search)) {
  $res=sel($config,'article',"limit {$off},{$sum}");
} else{
  $res=sel($config,'article',"where title like '%$search%'");
  
}




?> 
<div class="banner">
  <section class="box">
    <ul class="texts">
      <p>打了死结的青春，捆死一颗苍白绝望的灵魂。</p>
      <p>为自己掘一个坟墓来葬心，红尘一梦，不再追寻。</p>
      <p>加了锁的青春，不会再因谁而推开心门。</p>
    </ul>
    <div class="avatar"><a href="#"><span>杨青</span></a> </div>
  </section>
</div>
<div class="template">
  <div class="box">
    <h3>
      <p><span>个人博客</span>模板 Templates</p>
    </h3>
    <ul>
      <li><a href="/"  target="_blank"><img src="/home/public/images/01.jpg"></a><span>仿新浪博客风格·梅——古典个人博客模板</span></li>
      <li><a href="/" target="_blank"><img src="/home/public/images/02.jpg"></a><span>黑色质感时间轴html5个人博客模板</span></li>
      <li><a href="/"  target="_blank"><img src="/home/public/images/03.jpg"></a><span>Green绿色小清新的夏天-个人博客模板</span></li>
      <li><a href="/" target="_blank"><img src="/home/public/images/04.jpg"></a><span>女生清新个人博客网站模板</span></li>
      <li><a href="/"  target="_blank"><img src="/home/public/images/02.jpg"></a><span>黑色质感时间轴html5个人博客模板</span></li>
      <li><a href="/"  target="_blank"><img src="/home/public/images/03.jpg"></a><span>Green绿色小清新的夏天-个人博客模板</span></li>
    </ul>
  </div>
</div>

 <form action="/home/index.php" method="get">
   <input type="text" name="search">
   <button>search</button>
 </form>



<article>
  <h2 class="title_tj">
    <p>文章<span>推荐</span></p>
  </h2>
  <div class="bloglist left">

  <?php 
  
  foreach ($res as $v) {
   echo   '<h3>'.$v['title'].'</h3>
    <figure><img src="'.$v['pic'].'"></figure>
    <ul>
      <p>'.substr(strip_tags($v['content']),0,21).'</p>
      <a href="/home/articlede.php?id='.$v['id'].'" target="_blank" class="readmore">阅读全文>></a>
    </ul>
    <p class="dateview"><span>'.date('Y-m-d H:i:s',$v['time']).'</span><span>作者：'.$v['uid'].'</span></p>';
  }

   ?>
      <?php 
echo '<center>';
echo page($config,'article');
echo '</center>';
 ?>   
  </div>
  <aside class="right">
    <div class="weather"><iframe width="250" scrolling="no" height="60" frameborder="0" allowtransparency="true" src="http://i.tianqi.com/index.php?c=code&id=12&icon=1&num=1"></iframe></div>
    <div class="news">
    <h3>
      <p>随机<span>文章</span></p>
    </h3>
    <ul class="rank">
    <?php 
       $res_rand=sel($config,'article',"order by rand() limit 5");

       foreach ($res_rand as $v) {
        echo '<li><a href="/home/articlede.php?id='.$v['id'].'" title="'.$v['title'].'">'.$v['title'].'</a></li>';
       }
     ?>
 
      
    </ul>
    <h3 class="ph">
      <p>文章<span>分类</span></p>
    </h3>
    <ul class="paih">
     <?php 
      $res_cate=sel($config,'category');
      foreach ($res_cate as $v) {
      echo '<li><a href="/home/categorylist.php?id='.$v['id'].'" title="'.$v['name'].'" target="_blank">'.$v['name'].'</a></li>';
      }

      ?>

      
 
      
    </ul>
    <h3 class="links">
      <p>友情<span>链接</span></p>
    </h3>
    <ul class="website">
      <li><a href="/">个人博客</a></li>
      <li><a href="/">谢泽文个人博客</a></li>
      <li><a href="/">3DST技术网</a></li>
      <li><a href="/">思衡网络</a></li>
    </ul> 
    </div>  
    <!-- Baidu Button BEGIN -->
    <div id="bdshare" class="bdshare_t bds_tools_32 get-codes-bdshare"><a class="bds_tsina"></a><a class="bds_qzone"></a><a class="bds_tqq"></a><a class="bds_renren"></a><span class="bds_more"></span><a class="shareCount"></a></div>
    <script type="text/javascript" id="bdshare_js" data="type=tools&amp;uid=6574585" ></script> 
    <script type="text/javascript" id="bdshell_js"></script> 
    <script type="text/javascript">
document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000)
</script> 
    <!-- Baidu Button END -->   
    <a href="/" class="weixin"> </a></aside>
</article>
<?php 
include_once($_SERVER['DOCUMENT_ROOT'].'/home/public/footer.php');
?>